﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Osh.Configuration
{
	public class ConfigurationSection : System.Configuration.ConfigurationSection
	{
		protected override bool OnDeserializeUnrecognizedAttribute(string name, string value)
		{
			//return base.OnDeserializeUnrecognizedAttribute(name, value);
			Log.Error(Osh.Configuration.Configuration.TraceSource,
				@"Unrecognized configuration attribute '{0}/@{1}' at line {2} in '{3}' file. The attribute will be removed.",
				this.SectionInformation.SectionName, name, this.ElementInformation.LineNumber, this.ElementInformation.Source);
			return true;
		}

		protected override bool OnDeserializeUnrecognizedElement(string elementName, XmlReader reader)
		{
			//return base.OnDeserializeUnrecognizedElement(elementName, reader);
			Log.Error(Osh.Configuration.Configuration.TraceSource,
				"Unrecognized configuration element '{0}/{1}' at line {2} in '{3}' file. The element will be removed.",
				this.SectionInformation.SectionName, elementName, this.ElementInformation.LineNumber, this.ElementInformation.Source);
			return true;
		}
	}
}
